#ifndef __ITEXTURE__
#define __ITEXTURE__

#include <wx\wfstream.h>

#ifndef byte
typedef unsigned char byte;
#endif

struct Colorb;

/// <summary>
/// Interface to a texture.
/// Specific to scripts: this is just an opaque handle to a texture.
/// You cannot modify or access any members of this, as these are handled by
/// the program.
/// </summary>
class ITexture
{
public:
	/// <summary>
	/// Note that textures
	/// should NOT get unloaded if the destructor is called.
	/// The textures' data may have been copied over to another
	/// texture.
	/// </summary>
	virtual ~ITexture() { }

	/// <summary>
	/// Width of the texture.
	/// </summary>
	virtual const int &GetWidth() const = 0;

	/// <summary>
	/// Height of the texture.
	/// </summary>
	virtual const int &GetHeight() const = 0;

	/// <summary>
	/// The scale of the texture.
	/// </summary>
	virtual const int &GetScale() const = 0;

	/// <summary>
	/// Sets the scale.
	/// </summary>
	/// <param name="value">The value.</param>
	virtual void SetScale(const int &value) = 0;

	/// <summary>
	/// Load from data.
	/// </summary>
	/// <param name="data">Load from data.</param>
	virtual void Load(const byte *data, const int &width, const int &height) = 0;

	/// <summary>
	/// Load from a stream.
	/// </summary>
	/// <param name="stream">Load from a stream.</param>
	virtual void Load(wxInputStream &stream) = 0;

	/// <summary>
	/// Shallow copy right-hand side into this texture.
	/// This should ONLY copy the internal pointers/identifiers.
	/// Deep copies should not be done with this function.
	/// </summary>
	/// <param name="texture">Texture to copy from.</param>
	virtual void Copy(const ITexture *texture) = 0;

	/// <summary>
	/// Delete this texture. This should free all internal data
	/// for this texture. Note that all "Load" and "Copy" functions
	/// above should call this texture firstmost.
	/// </summary>
	virtual void Delete() = 0;

	/// <summary>
	/// Blit the image data to this pointer.
	/// </summary>
	virtual void BlitData(Colorb *ptr) = 0;

	/// <summary>
	/// Load from a file. Convenience wrapper.
	/// </summary>
	/// <param name="file">Load from a file.</param>
	void Load(const wxString &file)
	{
		wxFileInputStream stream(file);
		Load(stream);
	}
};
#endif